<template>
  <div class="app-content">
    <div class="search-content">
      <Title title="授权申领"></Title>
      <div class="search-input-content">
        <el-input
          v-model="queryParams.orderQuery"
          placeholder="可查询订单编号/业务员"
          size="small"
          class="search-input"
          @keyup.enter.native="handleQuery"
        >
        </el-input>

        <i class="el-icon-search search-icon" @click="handleQuery"></i>
        <i
          class="el-icon-circle-close search-icon"
          v-if="queryParams.orderQuery"
          @click="clear()"
        ></i>
      </div>
    </div>

    <div class="app-container">
      <el-table stripe :data="orderList">
        <el-table-column label="序号" prop="index" width="55">
          <template slot-scope="scope">
            <span>{{ scope.$index + 1 }}</span>
          </template>
        </el-table-column>
        <el-table-column
          label="事业部"
          align="center"
          prop="bu"
        ></el-table-column>
        <el-table-column
          label="办公室"
          align="center"
          prop="salesOffice"
        ></el-table-column>
        <el-table-column label="订单编号" align="center" prop="fromNo" />
        <el-table-column label="订单名称" align="center" prop="prdtName" />
        <el-table-column label="客户名称" align="center" prop="customerName">
          <template slot-scope="scope">
            <span>{{
              scope.row.customerName
                ? scope.row.customerName
                : scope.row.stpName
            }}</span>
          </template>
        </el-table-column>
        <el-table-column label="业务员" align="center" prop="salesman" />
        <el-table-column
          label="项目负责人"
          align="center"
          prop="projectManager"
        />
        <!-- <el-table-column
          label="负责人电话"
          align="center"
          prop="projectManagerTel"
        /> -->
        <!-- <el-table-column label="订单负责人" align="center" prop="nickName">
          <template slot-scope="scope">
            <span>{{
              scope.row.manager ? scope.row.manager.nickName : null
            }}</span>
          </template>
        </el-table-column> -->
        <el-table-column label="订单产品" align="center" prop="prdtStatus">
          <template slot-scope="scope">
            <el-button
              size="middle"
              type="text"
              @click="handleDetail(scope.row)"
              >产品明细</el-button
            >
          </template>
        </el-table-column>
      </el-table>

      <pagination
        v-show="total > 0"
        :total="total"
        :page.sync="queryParams.pageNum"
        :limit.sync="queryParams.pageSize"
        @pagination="getList"
      />
    </div>
  </div>
</template>

<script>
import Title from "../../components/title";
// import { authList } from "@/api/authLogin/auth";

export default {
  name: "authLoginIndex",
  components: { Title },
  data() {
    return {
      title: "",
      // 遮罩层
      loading: true,
      // 总条数
      total: 0,
      // 表格数据
      orderList: [],
      // 弹出层标题
      title: "",
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        orderQuery: null,
      },
    };
  },
  created() {
    this.getList();
  },
  methods: {
    // 查询产品信息列表
    getList() {
      this.loading = true;
      // authList(this.queryParams).then((response) => {
      //   this.orderList = response.rows;
      //   this.total = response.total;
      //   this.loading = false;
      // });
    },
    // 跳转-产品明细页面-路由传参
    handleDetail(row) {
      this.$router.push({
        path: "/authLogin/detail",
        query: { fromNo: row.fromNo, stpName: row.stpName },
      });
    },
    // 搜索按钮操作
    handleQuery() {
      this.queryParams.pageNum = 1;
      console.log(this.queryParams);
      this.getList();
    },
    // 清空
    clear() {
      (this.queryParams.orderQuery = ""), this.handleQuery();
    },
  },
};
</script>

<style lang="scss" rel="stylesheet/scss" scoped>
.search-content {
  display: flex;
  // background-image: url("../../../assets/images/title.png") no-repeat;
  height: 50px;
  width: 100%;
  background: #fff;
  font-size: 18px;
  font-family: Source Han Sans CN, Source Han Sans CN-Medium;
  font-weight: 600;
  text-align: left;
  color: #333333;
  border-bottom: 2px solid #f5f7fa;
  justify-content: space-between;
  .search-input {
    width: 190px;
    height: 30px;
    // margin: auto 20px;
    margin-left: 10px;
  }
}
::v-deep .search-input .el-input__inner {
  // border-radius: 16px;
  border: 0px;
}
.groupBtn {
  width: 80px;
  height: 32px;
  color: #fff;
  text-align: center;
  font-size: 14px;
  // background-image: url("../../assets/images/product/btn.png");
  // background-size: cover;
  background: #e60012;
  margin-bottom: 10px;
}
// 按钮文字居中
::v-deep .groupBtn {
  position: relative;
  span {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
  }
}
</style>
